home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / newsgroups / misc.19950929-19951130 / 000167_news@columbia.edu_Sat Oct 21 15:12:07 1995.msg < prev    next >
Internet Message Format  |  2020-01-01  |  3KB

  1. Received: from apakabar.cc.columbia.edu by watsun.cc.columbia.edu with SMTP id AA05413
  2.   (5.65c+CU/IDA-1.4.4/HLK for <kermit.misc@watsun.cc.columbia.edu>); Sat, 21 Oct 1995 11:12:12 -0400
  3. Received: by apakabar.cc.columbia.edu id AA25234
  4.   (5.65c+CU/IDA-1.4.4/HLK for kermit.misc@watsun); Sat, 21 Oct 1995 11:12:10 -0400
  5. Path: news.columbia.edu!watsun.cc.columbia.edu!fdc
  6. From: fdc@watsun.cc.columbia.edu (Frank da Cruz)
  7. Newsgroups: comp.protocols.kermit.misc
  8. Subject: Re: Is there a bug in fonction \Fcode(Char)
  9. Date: 21 Oct 1995 15:12:07 GMT
  10. Organization: Columbia University
  11. Lines: 79
  12. Message-Id: <46b2k7$okf@apakabar.cc.columbia.edu>
  13. References: <468l5o$sai@midgard.calvacom.fr>
  14. Nntp-Posting-Host: watsun.cc.columbia.edu
  15. Apparently-To: kermit.misc@watsun.cc.columbia.edu
  16.  
  17. In article <468l5o$sai@midgard.calvacom.fr>,
  18. Dominique Ottello <do11@calvacom.fr> wrote:
  19. : I think there is a bug into Kermit MS-DOS Version 3.14
  20. : The fonction \Fcode(Char) return the value 150 for a space as for 
  21. : u-circomflex.  I try this :
  22. : define line ==   SERIAL NUMBER : D00536      ==
  23. : ;
  24. : ; Search for position of (:) into Line
  25. : assign Begin \Findex(:,\m(Ligne),1)
  26. : increment Begin
  27. : ;
  28. : ; Extract substring beginning after (:) to the end of Line into SN2End
  29. : assign SN2End \Fsubstr(\m(Line),\m(Begin),)
  30. : ;
  31. : define \%n 1
  32. : :Bcl
  33. : assign Tmp \Fsubstr(\m(SN2End),\%n,1)
  34. : ;
  35. : assign Ascii \Fcode(\m(Tmp))
  36. : echo {Char=\m(Tmp) Code=\m(Ascii)}
  37. : ;
  38. : ; Test if the character is a Space
  39. : if = \m(Ascii) 32 goto LenOK
  40. : increment \%n
  41. : goto Bcl
  42. : ;
  43. : :LenOK
  44. : decrement \%n
  45. : assign SN \Fsubstr(\m(SN2End),1,\%n)
  46. : echo Line=\M(Line)
  47. : echo {SN extracted from Line=\m(SN)}
  48. : There are spaces after D00536 into variable Line,
  49. : but the fonction \Fcode(\m(Tmp)) always return 150 when Tmp is a space.
  50. : So, I am not able to test where ends the serial number.
  51. : Is there a patch to correct this problem ?
  52. : Or is there any possibility to do this test another way ?
  53. It is indeed a problem.  It seems that in MS-DOS Kermit, when a variable
  54. has a value of SPACE (ASCII 32), it just disappears, so in your script
  55. program, \Fcode(\m(tmp)) is taking the value of a random memory byte.  You
  56. can work around this problem as follows:
  57.  
  58. ---(cut)---
  59. define line ==   SERIAL NUMBER : D00536      ==
  60. ;
  61. echo LINE="\m(line)"
  62.  
  63. ; Search for position of (:) into Line
  64. assign Begin \Findex(:,\m(Line),1)      ;; <--- "Line", not "Ligne"
  65. increment Begin
  66. ;
  67. ; Extract substring beginning after (:) to the end of Line into SN2End
  68. assign SN2End \Fsubstr({\m(Line)},\m(Begin),)
  69.  
  70. define \%n 1
  71. assign length \flength(\m(SN2End))            ; Get length of substring
  72.  
  73. :Bcl
  74. assign Tmp _\Fsubstr({\fdef(SN2End)},\%n,1)_  ; Put _ before and after char
  75. assign Ascii \Fcode(\Fsubstr(\m(TMP),2,1))    ; Get code of char between _'s
  76.  
  77. ; Test if the character is a Space
  78. if = \m(Ascii) 32 goto LenOK
  79. increment \%n
  80. if > \%n \m(length) stop 1 END OF STRING...   ; Avoid infinite loop
  81.  
  82. goto Bcl
  83. ;
  84. :LenOK
  85. decrement \%n
  86. assign SN \Fsubstr(\m(SN2End),1,\%n)
  87. echo Line=\M(Line)
  88. echo {SN extracted from Line="\m(SN)"}
  89. ---(cut)---
  90.  
  91. - Frank